import os, json

homedir =  os.path.expandvars('$HOME')

a_token = 'Atza|IwEBICQh9XwLH2tzpBfIKhd3epRC174X4Y4Xyrx20ytUQagpByrZe333kBmpE4dk7dbf_jk6kxFl1DYfGdSBzShnt0mbeFJRN2Ql_IAB0-S4SgpzjIotSgrCXL-o59y2lu0rzKucMOz04bGzsPf0aB-PCMj0ab9eyxWmHWXbQcvv24gRbaQUEw3cEao-I833lE6BMACdT2NvyHHfs8au0smdJTbySdBV2yLxeZC5QOXKj_ns6yIDkv6zbgO2J9mgkWBq5q12GEWpS-dUlHFBhLcQ34bdVuWq0mUzyNQfGaiI0n-YolovWHv0YqMw5jpF34eNU7uCI9oj29nrBBGUcseeKiMnDEdAWGfKt61NcnyvjJ-x8-kcs2GCZkj_fBn-Ib30O_Sb1ebmVmAaeGogrVkGXvAz0iwiZLH4Z8mhYbVOocURd-ggq-0rEX-uEqFN-j0urmW_0V6mj9D98j8K1AGj5Rrprr6u3wdXk-VZgBztUU_uEZp-DJw_XwYcQisA4ZBxI0Pi2jmDDHl5iRw0ICkxob2Djh5C0lNiVhxvOzRZsGzg0CcbqFeNtBXwm3RkgthwSak'
r_token = 'Atzr|IwEBII5cV0MU1A4hrELKrffNvIQo7hCLjDVGmdQHAbygvgCG3jsANrVIoRz2BV65YgaJLtSzVjFxw1GiAYJsDFVTb5WyqttG-Scy9rkPX08cdwihkeWWz2iN6M_cC4sXTCIuv3-CqgtjApl8jWcu1q0EV9E5_L2MtKTfAaOaK3KQFzmyTPjckhLPCBv13TzqqFaQRsAPE6o2E1UmhkoctChRFUtC8K_7TBzn0WW_na78GsuzfANwuES2hLn6eHz0IiBPiSxhXL79KTFT6-SkKYhWVzzwC3uJQgePiWRF_67M-_GOvujsMZb4XzIdWLbYdlB_edaK_JV-b3Slu-U6c9uzWwNpyMku9_yyELBPPMYusSNlw3bmnALSWumkaaPoRziqtDLsWAK7tltujkODbsz-PsyYi3Fgetj1xrCePDK3AnAb4btDu5W7ApEOrwCf9CWo08gq7mXURLLcSngmdJ59MxOEGAM7OlF9Zf0TjvlIiSlffMC60M3_q9DaE9b-tlyPMj0O5eui3a4p7PZ8OOfdokrT'
t_type = 'bearer'
expires = 3600
client_id = 'amzn1.application-oa2-client.45bf7b09f55243ce86a031bd2917cc97'
client_sec = 'f374c78f32fbe86f98f492b5df5ae535d1ce5f1231a486268809c5b7b42ae294'
s_path = os.path.join(homedir,'.Alexa/audio/send/')
r_path = os.path.join(homedir,'.Alexa/audio/recivied/')
sys_path = os.path.join(homedir, '.Alexa/src/audio/')

if(not os.path.exists(os.path.join(homedir,'.Alexa/audio/send'))):
    os.makedirs(os.path.join(homedir,'.Alexa/audio/send'))

if(not os.path.exists(os.path.join(homedir,'.Alexa/audio/recivied'))):
    os.makedirs(os.path.join(homedir,'.Alexa/audio/recivied'))

config_dict = {}
config_dict['access_token'] = a_token
config_dict['refresh_token'] = r_token
config_dict['token_type'] = t_type
config_dict['expires_in'] = expires
config_dict['client_id'] = client_id
config_dict['client_secret'] = client_sec
config_dict['s_audio_path'] = s_path
config_dict['r_audio_path'] = r_path
config_dict['sys_audio_path'] = sys_path

with open(os.path.join(homedir,'.Alexa/config.json'),'w+') as f:
    json.dump(config_dict,f,indent=4)



device_dict = {}
device_dict['InputDeviceNum'] = 4
device_dict['RecTruckSize'] = 512

with open(os.path.join(homedir,'.Alexa/deviceinfo.json'),'w+') as p:
    json.dump(device_dict,p,indent=4)


print('Init Completed!\n')

print('Something else...\n')
print('Check the input device number by running \'deviceinfo\' \n')
print('Go to ~/.Alexa/deviceinfo.json and modify value of \'InputDeviceNum\' \n')
